package com.cherrish.demo;

import java.math.BigDecimal;
import java.util.concurrent.ArrayBlockingQueue;

/**
 * @author ccl
 * @time 2019-01-18 13:50
 * @name Test
 * @desc:
 */
public class Test {
    private int aa;
    public static void main(String[] args) {
        int[] src = new int[]{1,2,0,3,5,6,7,9,2,0};
        int[] dest = new int[src.length];
        System.arraycopy(src, 0, dest, 0, src.length);

        print(src);
        print(dest);

        print(twoSum(src, 5));

        ArrayBlockingQueue a;

        BigDecimal b1 = new BigDecimal(5);
        BigDecimal b2 = new BigDecimal(5);
        System.out.println(b1.compareTo(b2));

        System.out.println(-7 / 3);
        System.out.println(-7 / -3);

        System.out.println(-7 % 3);
        System.out.println(-7 % -3);

    }

    public static int[] twoSum(int[] nums, int target) {
        for(int i = 0; i < nums.length - 1; i++){
            for(int j = i + 1; j < nums.length; j++){
                if((nums[i] + nums[j]) == target){
                    return new int[]{i, j};
                }
            }
        }
        return null;
    }

    static private void print(int[] arr){
        System.out.println();
        for(int i = 0; i < arr.length; i++){
            System.out.print(arr[i] + "  ");
        }
        System.out.println();
    }
}
